redisIncr
increments the Redis string value corresponding to the
specified key by one.redisDecr
decrements the Redis string value corresponding to the
specified key by one.
The various *By functions increment or decrement values by a specified integer or numeric value.
redisIncr(key)
redisIncrBy(key, value)
redisIncrByFloat(key, value)
redisDecr(key)
redisDecrBy(key, value)
The increment value may be an integer (redisIncrBy
) or a numeric value
(redisIncrByFloat
), or a raw character representation of an integer or
numeric value. If the key does not exist or contains a value of a wrong type,
set the key to the value of "0" or similar string representation of an integer
before running the function.
redisDecr
## Not run:
# redisSet('x',charToRaw('5')) # Note the value must be a raw string!
# redisIncr('x')
# redisIncrBy('x','3')
# redisIncrBy('x',3) # also works
# redisIncrByFloat('x',pi)
# redisDecr('x')
# redisDecrBy('x',3)
# ## End(Not run)
Run the code above in your browser using DataLab